package com.punch.common.utils;


import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 生成订单编号
 *
 * @author Liang
 */
public class OrderSerialNoUtil {
    public static String generateOrderNo() {
        Date currentTime = new Date();
        SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
        String dateString = formatter.format(currentTime);
        //生成三位随机数
        int x = (int) (Math.random() * 900) + 100;
        return "SO" + dateString + x;
    }

    public static String generateCourseOrderNo() {
        Date currentTime = new Date();
        SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
        String dateString = formatter.format(currentTime);
        //生成三位随机数
        int x = (int) (Math.random() * 900) + 100;
        return "SOC" + dateString + x;
    }

    public static String generateMaterialOrderNo() {
        Date currentTime = new Date();
        SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
        String dateString = formatter.format(currentTime);
        //生成三位随机数
        int x = (int) (Math.random() * 900) + 100;
        return "SOM" + dateString + x;
    }
}
